package com.gillion.grule.client.logger;


import com.gillion.grule.client.utils.MessageFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



public class LoggerAppender
{
    private StringBuilder stringBuilder = new StringBuilder();


    private static final Logger LOGGER = LoggerFactory.getLogger("rule-log");






    public void append(String messageTemplate, Object... args) {
        LOGGER.info(messageTemplate, args);
        this.stringBuilder.append(MessageFormatter.arrayFormat(messageTemplate, args).getMessage())
                .append("\n");
    }

    public String getMessage() {
        return this.stringBuilder.toString();
    }
}
